#!/bin/sh
datastore_path='datastore1'
echo "create /vmfs/volumes/${datastore_path}/etc/timer_reboot.sh scripts......"
mkdir -p /vmfs/volumes/${datastore_path}/etc/;
echo "#!/bin/sh" > /vmfs/volumes/${datastore_path}/etc/timer_reboot.sh
echo "/sbin/reboot;" >> /vmfs/volumes/${datastore_path}/etc/timer_reboot.sh
chmod 755 /vmfs/volumes/${datastore_path}/etc/timer_reboot.sh;


echo "update /etc/rc.local.d/local.sh ......"

sed -i 's#^/bin/kill.*##g' /etc/rc.local.d/local.sh;
sed -i 's#^/bin/echo.*##g' /etc/rc.local.d/local.sh;
sed -i 's#^/usr/lib/vmware/busybox/bin/busybox.*##g' /etc/rc.local.d/local.sh;
sed -i 's/^exit 0//g' /etc/rc.local.d/local.sh;

echo ''
echo '/bin/kill $(cat /var/run/crond.pid)' >> /etc/rc.local.d/local.sh;
echo "/bin/echo '0 19 * * 5 /vmfs/volumes/${datastore_path}/etc/timer_reboot.sh' >> /var/spool/cron/crontabs/root" >> /etc/rc.local.d/local.sh;
echo "/usr/lib/vmware/busybox/bin/busybox crond"  >> /etc/rc.local.d/local.sh;
echo "exit 0" >> /etc/rc.local.d/local.sh;



#  wget  --no-check-certificate http://gitee.com/team_space/mynet_info/raw/master/exsi_crontab.sh -O exsi_crontab.sh&& sh exsi_crontab.sh